#include "precompiled.h"
#include "HealthComponent.h"


HealthComponent::HealthComponent(void)
{
}


HealthComponent::~HealthComponent(void)
{
}


void HealthComponent::Initialize( int maxHealth, int currentHealth ){
	max_health = maxHealth;
	current_health = currentHealth;
}
int &HealthComponent::CurrentHealth(){
	return current_health;
}
float HealthComponent::HealthPercentage(){
	return static_cast<float>(current_health) / static_cast<float>(max_health);
}

void HealthComponent::KillHealth(){
	current_health=0.0f;
}

void HealthComponent::RefreshHealth(){
	current_health=max_health;
}


void HealthComponent::LowerHealth( int rate ){
	current_health -= rate;
	current_health = glm::max( 0, current_health );
}
void HealthComponent::RaiseHealth( int rate ){
	current_health += rate;
	current_health = glm::min( max_health, current_health );
}